<?php
/**
 * Created by PhpStorm.
 * User: freethy
 * Date: 2018-05-11
 * Time: 9:49
 */

namespace app\admin;
use think\Request;

class Auth
{

    public function run(&$params)
    {
        //获取请求信息
        $request = Request::instance();
        $controller = $request->controller();

        //控制器不验证
        if($controller == "Bus" || $controller == "Mail"){
            return;
        }
        //需要验证
        $user = session("MAP_USER");

        //没有登录
        if(!$user){
            header("location: ".url('@bus/index/index')."?url=".urlencode($request->url()));
            die();
        }

    }
}